package com.game.cards.traps;

import com.game.cards.MonsterCard;
import com.game.cards.TrapCard;
import com.game.play.Events;
import com.game.play.Game;

public class ReverseTrapHole extends TrapCard{
	
	public ReverseTrapHole(){
		
		this.title = "Reverse Trap Hole";
		this.description = "If a monster is summon with attack below 1000, "
				+ "\n that monster is sent to the graveyard.";
		this.trigger = Events.normalsummon;
	}
	
	public boolean test(Game game){
		
		String[] args =  (game.getCurrentTurn().getAq().getEventArgs(this.getTrigger()));
		int tid = Integer.valueOf(args[1]);
		
		MonsterCard c = (MonsterCard)game.getCardById(tid);
		if (c.getAttack() <= 1000 && c.getDeck().getOwner() != this.getDeck().getOwner())
		{
			c.getDeck().getOwner().getField().removeMonsterById(tid);
			game.getCurrentTurn().getAq().addEvent(Events.destroycard +","+tid);
			System.out.println(c.getTitle() + " was caught in a trap hole and sent to the graveyard!");
			this.getDeck().getOwner().getField().removeSpellTrapById(this.id);
			return true;
		}
		return false;
	}
		

}
